Skip to content

docs: #15 Custom Eventsの翻訳 #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 21, 2020

Conversation

fussy113
Copy link
Collaborator

resolve #15

@netlify
Copy link

netlify bot commented Sep 19, 2020

Deploy preview for vuejs-v3-ja-doc-preview ready!

Built with commit f16c2c2

https://deploy-preview-64--vuejs-v3-ja-doc-preview.netlify.app

Copy link
Member

@kazupon kazupon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

レビュー 👀 コメント 💬 しました!
対応お願いします!


```js
this.$emit('myEvent')
```

Listening to the kebab-cased version will have no effect:
ケバブケース(kebab-case)でリスナ名を作っても何も起こりません:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

細かいですが、 : でお願いします!

Suggested change
ケバブケース(kebab-case)でリスナ名を作っても何も起こりません
ケバブケース(kebab-case)でリスナ名を作っても何も起こりません:


::: tip
It is recommended to define all emitted events in order to better document how a component should work.
ネイティブイベント( `click` など)が `emits` オプションで定義されている場合、ネイティブリスナーとして扱われるのではなく、コンポーネントのイベントによって上書きされます。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(e.g., click)(例、 click) でお願いします!

Suggested change
ネイティブイベント( `click` など)が `emits` オプションで定義されている場合、ネイティブリスナーとして扱われるのではなく、コンポーネントのイベントによって上書きされます。
ネイティブイベント(例、`click` など)が `emits` オプションで定義されている場合、ネイティブリスナーとして扱われるのではなく、コンポーネントのイベントによって上書きされます。

It is recommended to define all emitted events in order to better document how a component should work.
ネイティブイベント( `click` など)が `emits` オプションで定義されている場合、ネイティブリスナーとして扱われるのではなく、コンポーネントのイベントによって上書きされます。

::: ヒント
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tip は訳さなくて大丈夫です!


Similar to prop type validation, an emitted event can be validated if it is defined with the Object syntax instead of the Array syntax.
プロップタイプの検証と同様に、発行されたイベントは、配列構文ではなくオブジェクト構文で定義されている場合に検証できます。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prop type validation は訳すとしてた プロパティの型検証 ですね。


By default, `v-model` on a component uses `modelValue` as the prop and `update:modelValue` as the event. We can modify these names passing an argument to `v-model`:
デフォルトでは、コンポーネントの `v-model` はプロップとして `modelValue` を使用し、イベントとして `updatemodelValue` を使用します。`v-model` 引数を渡してこれらの名前の変更が出来ます。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prop は `プロパティでお願いします!

Suggested change
デフォルトでは、コンポーネントの `v-model` はプロップとして `modelValue` を使用し、イベントとして `update:modelValue` を使用します。`v-model` 引数を渡してこれらの名前の変更が出来ます。
デフォルトでは、コンポーネントの `v-model` はプロパティとして `modelValue` を使用し、イベントとして `update:modelValue` を使用します。`v-model` 引数を渡してこれらの名前の変更が出来ます。


```html
<my-component v-model:foo="bar"></my-component>
```

In this case, child component will expect a `foo` prop and emits `update:foo` event to sync:
この場合、子コンポーネントは `foo` プロップを期待し、同期するために `update:foo` イベントを発行します。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
この場合、子コンポーネントは `foo` プロップを期待し、同期するために `update:foo` イベントを発行します。
この場合、子コンポーネントは `foo` プロパティを期待し、同期するために `update:foo` イベントを発行します。


Each v-model will sync to a different prop, without the need for extra options in the component:
それぞれの v-model は、コンポーネントに追加オプションを必要とせず、異なるプロップに同期します。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
それぞれの v-model は、コンポーネントに追加オプションを必要とせず、異なるプロップに同期します
それぞれの v-model は、コンポーネントに追加オプションを必要とせず、異なるプロパティに同期します


Notice that when the component's `created` lifecycle hook triggers, the `modelModifiers` prop contains `capitalize` and its value is `true` - due to it being set on the `v-model` binding `v-model.capitalize="bar"`.
コンポーネントの `created` ライフサイクルフックがトリガーされると、`modelModifiers` プロップには `capitalize` が含まれ、その値は`true` になります。これは、 `v-model` バインディングに `v-model.capitalize = "var"` が設定されているためです。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
コンポーネントの `created` ライフサイクルフックがトリガーされると、`modelModifiers` プロップには `capitalize` が含まれ、その値は`true` になります。これは、 `v-model` バインディングに `v-model.capitalize = "var"` が設定されているためです。
コンポーネントの `created` ライフサイクルフックがトリガーされると、`modelModifiers` プロパティには `capitalize` が含まれ、その値は`true` になります。これは、 `v-model` バインディングに `v-model.capitalize = "var"` が設定されているためです。

@@ -172,7 +174,7 @@ app.component('my-component', {
})
```

Now that we have our prop set up, we can check the `modelModifiers` object keys and write a handler to change the emitted value. In the code below we will capitalize the string whenever the `<input />` element fires an `input` event.
プロップを設定したので、 `modelModifiers` オブジェクトのキーを確認し、発行された値を変更するハンドラーを記述できます。以下のコードでは、 `<input />` 要素が `input` イベントを発生させるたびに文字列を大文字にします。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
プロップを設定したので`modelModifiers` オブジェクトのキーを確認し、発行された値を変更するハンドラーを記述できます。以下のコードでは、 `<input />` 要素が `input` イベントを発生させるたびに文字列を大文字にします。
プロパティを設定したので`modelModifiers` オブジェクトのキーを確認し、発行された値を変更するハンドラーを記述できます。以下のコードでは、 `<input />` 要素が `input` イベントを発生させるたびに文字列を大文字にします。

@@ -215,7 +217,7 @@ app.component('my-component', {
app.mount('#app')
```

For `v-model` bindings with arguments, the generated prop name will be `arg + "Modifiers"`:
引数を持つ `v-model` バインディングの場合、生成されるプロップ名は `arg + "Modifiers"` になります。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
引数を持つ `v-model` バインディングの場合、生成されるプロップ名は `arg + "Modifiers"` になります。
引数を持つ `v-model` バインディングの場合、生成されるプロパティ名は `arg + "Modifiers"` になります。

@fussy113
Copy link
Collaborator Author

@kazupon
ご確認、ありがとうございます!
ご指摘いただいた内容、修正しましたので、ご確認をお願いします!

@kazupon
Copy link
Member

kazupon commented Sep 21, 2020

@fussy113
ありがとうございます!
修正箇所確認しました!
マージします!

@kazupon kazupon merged commit c67403c into vuejs-jp:lang-ja Sep 21, 2020
@kazupon
Copy link
Member

kazupon commented Sep 21, 2020

翻訳ありがとうございました!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Components In-Depth > Custom Events の翻訳
2 participants